<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('爬虫系统主页')"/>
</head>
<body>
    <div class="layui-container">
        <form class="layui-form" style="margin-top: 30px">
            <div class="layui-form-item">
                <label class="layui-form-label">cron表达式</label>
                <div class="layui-input-block">
                    <input name="cron" class="layui-input" id="cron">
                </div>
            </div>
            <div class="layui-form-item">
                <a lay-submit="" lay-filter="submitBtn"
                   class="layui-btn layui-btn-lg layui-bg-orange">
                    <i class="layui-icon layui-icon-share"></i>提交
                </a>
                <a lay-submit="" lay-filter="startBtn"
                   class="layui-btn layui-btn-lg layui-bg-blue">
                    <i class="layui-icon layui-icon-read"></i>启动
                </a>
                <a lay-submit="" lay-filter="pauseBtn"
                   class="layui-btn layui-btn-lg layui-bg-red">
                    <i class="layui-icon layui-icon-pause"></i>暂停
                </a>
                <a lay-submit="" lay-filter="editCronBtn"
                   class="layui-btn layui-btn-lg layui-bg-black">
                    <i class="layui-icon layui-icon-edit"></i>编辑cron
                </a>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer"/>
    <script>
        var $;
        layui.use(['form','jquery','layer'],function () {
            var form = layui.form,layer = layui.layer;
            $ = layui.jquery;
            form.on("submit(submitBtn)",function (data) {
                var data = data.field;
                $.post("/tqc/addQuartz",data,function (result) {
                    layer.msg(result.msg);

                });
            });
            form.on("submit(startBtn)",function (data) {
                var data = data.field;
                $.post("/tqc/resumeQuartz",function (result) {
                    layer.msg(result.msg);

                });
            });
            form.on("submit(pauseBtn)",function (data) {
                var data = data.field;
                $.post("/tqc/pauseQuartz",function (result) {
                    layer.msg(result.msg);

                });
            });
            form.on("submit(editCronBtn)",function (data) {
                layer.open({
                    type:2,
                    content:'/tqc/editCron',
                    area:['850px','100%'],
                    offset:'c',

                });
            })


        });

        function changeCron(value){
            $('#cron').attr("value",value);
        }
    </script>
</body>
</html>
